#include "cc.h"
#include "bsp_clk.h"
#include "bsp_delay.h"
#include "bsp_led.h"
#include "bsp_uart.h"
#include "bsp_int.h"
#include "stdio.h"

#include "bsp_lcd.h"
#include "bsp_lcdapi.h"

/* 背景颜色索引 */
unsigned int backcolor[10] = {
	LCD_BLUE, 		LCD_GREEN, 		LCD_RED, 	LCD_CYAN, 	LCD_YELLOW, 
	LCD_LIGHTBLUE, 	LCD_DARKBLUE, 	LCD_WHITE, 	LCD_BLACK, 	LCD_ORANGE

}; 

int main(int argc, const char * argv[])
{
	unsigned char index = 0;
	unsigned char state = OFF;

    #if GPT1_INTERRUPT_ENA == 1
    int_init(); 				/* 初始化中断(一定要最先调用！) */
    #endif
	imx6u_clkinit(); /* 初始化系统时钟 			*/
	delay_init();    /* 初始化延时 			*/
	led_init();	     /* 初始化led 			*/
	uart_init();     /* 初始化串口，波特率115200 */
	lcd_init();      /* 初始化LCD 			*/
    printf("*** Build Time: %s %s,Git Version: %s Git Remote: %s ***\r\n", __DATE__, __TIME__, GIT_VERSION, GIT_PATH);
    
	tftlcd_dev.forecolor = LCD_RED;	  

	while(1)				
	{	
		lcd_clear(backcolor[index]);
		delayms(1); 	  
		lcd_show_string(10, 40, 260, 32, 32,(char*)"ALPHA IMX6U"); 	
		lcd_show_string(10, 80, 240, 24, 24,(char*)"RGBLCD TEST");
		lcd_show_string(10, 110, 240, 16, 16,(char*)"SUMU@LCD DEMO");      					 
		lcd_show_string(10, 130, 240, 12, 12,(char*)"2025/4/11");	      					 
	    index++;
		if(index == 10)
			index = 0;      
		state = !state;
		led_switch(LED0,state);
		delayms(1000);

		state = !state;
		led_switch(LED0, state);
	}

	return 0;
}
